/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.asistente.entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Wizard
 */
@Entity
@Table(name = "hd_roles")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HdRoles.findAll", query = "SELECT h FROM HdRoles h"),
    @NamedQuery(name = "HdRoles.findByCodRol", query = "SELECT h FROM HdRoles h WHERE h.codRol = :codRol"),
    @NamedQuery(name = "HdRoles.findByDesRol", query = "SELECT h FROM HdRoles h WHERE h.desRol = :desRol"),
    @NamedQuery(name = "HdRoles.findByIndEstadoRol", query = "SELECT h FROM HdRoles h WHERE h.indEstadoRol = :indEstadoRol")})
public class HdRoles implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "COD_ROL")
    private Integer codRol;
    @Size(max = 50)
    @Column(name = "DES_ROL")
    private String desRol;
    @Column(name = "IND_ESTADO_ROL")
    private Character indEstadoRol;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codRol", fetch = FetchType.LAZY)
    private Collection<HdUsuarios> hdUsuariosCollection;

    public HdRoles() {
    }

    public HdRoles(Integer codRol) {
        this.codRol = codRol;
    }

    public Integer getCodRol() {
        return codRol;
    }

    public void setCodRol(Integer codRol) {
        this.codRol = codRol;
    }

    public String getDesRol() {
        return desRol;
    }

    public void setDesRol(String desRol) {
        this.desRol = desRol;
    }

    public Character getIndEstadoRol() {
        return indEstadoRol;
    }

    public void setIndEstadoRol(Character indEstadoRol) {
        this.indEstadoRol = indEstadoRol;
    }

    @XmlTransient
    public Collection<HdUsuarios> getHdUsuariosCollection() {
        return hdUsuariosCollection;
    }

    public void setHdUsuariosCollection(Collection<HdUsuarios> hdUsuariosCollection) {
        this.hdUsuariosCollection = hdUsuariosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codRol != null ? codRol.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HdRoles)) {
            return false;
        }
        HdRoles other = (HdRoles) object;
        if ((this.codRol == null && other.codRol != null) || (this.codRol != null && !this.codRol.equals(other.codRol))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.asistente.DAO.HdRoles[ codRol=" + codRol + " ]";
    }
    
}
